home *** CD-ROM | disk | FTP | other *** search
Text File | 1985-08-11 | 11.8 KB | 461 lines | [TEXT/Anon] |
-
- MAC.68K
-
-
-
- LOCAL LOCAL LOCAL
-
-
-
- PURPOSE To define unique names for use within a macro
- definition.
-
-
-
- FORMAT LOCAL symbol1,symbol2,...symbolN
-
-
-
- DESCRIPTION LOCAL must immediately follow the MACRO or MACROL
- pseudo op. It contains a list of symbols that are to
- be used only within the macro body. During macro
- expansion, local symbols are replaced with a symbol
- name of ..hhhh where hhhh is a hex number starting at
- 0000 and being incremented by one each time a local
- symbol is generated. By generating unique names for
- each macro call, a macro may use internal location
- symbols or EQUs and not produce duplicate name errors
- if called more than once. Local symbols do not appear
- in the symbol table and are not cross referenced.
-
-
-
- EXAMPLE ZEROUT MACRO LOCATION,COUNT
- LOCAL LOOP,EXIT
- MOVE #COUNT,D0
- BLE.S EXIT
- LEA LOCATION,A0
- LOOP CLR.B (A0)+
- DBF D0,LOOP
- EXIT DS 0
- ENDM
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -45- MAC.68K
- MAC.68K
-
-
- MACRO MACRO MACRO
-
-
-
- PURPOSE To define a macro.
-
-
-
- FORMAT macroname MACRO parameter1,parameter2,...parameterN
-
-
-
- DESCRIPTION MACRO is followed by a block of code terminated by
- an ENDM. This block of code, called the macro body,
- is saved and may be inserted into the program assembly
- at any future point by using the macro name as an
- operation code.
-
- A macro may be defined with 0 to 127 formal
- parameters. The parameters are listed in the operand
- field of the MACRO statement and are separated by
- commas. A parameter may be any valid symbol name.
- These parameters may appear in any instruction field
- within the body of the macro. At macro call time, when
- the macro name is used as an operation code, the
- operand field contains its own list of actual
- parameters separated by commas. The first actual
- parameter is substituted for all occurances of the
- first formal parameter in the macro body, the second
- actual parameter is substituted for all appearances of
- the second formal parameter, and so on. The resulting
- block of code, called the macro expansion, is inserted
- into the assembly immediately following the macro
- call.
-
- Local symbols and macro parameters are recognized
- in the macro body if they are delimited by:
- space + - * / ( ) & , = "
-
- Any actual macro parameter may be placed in
- parenthesis. This is especially useful for passing
- special characters such as commas or spaces. An actual
- parameter may be null. Its macro body substitution
- will also be null.
-
- A symbol in the location field of a MACRO call is
- assigned a permanent value equal to the location
- counter prior to the macro expansion.
-
- Macro expansions may contain calls to other macros
- or even to the same macro. A limit of 5 nested macro
- calls is allowed.
-
-
-
-
-
-
- MAC.68K -46-
- MAC.68K
-
-
- EXAMPLES
-
- definition call expansion
-
-
- TEST MACRO TEST null
- ENDM
-
-
-
- ADD3 MACRO P1,P2,P3 ADD3 7,8,9 MOVE 7,D1
- MOVE P1,D1 ADD 8,D1
- ADD P2,D1 ADD 9,D1
- ADD P3,D1
- ENDM
-
-
-
- CADD MACRO P1,P2,P3 CADD 4,5 MOVE 4,D1
- LOCAL JTAG IFS NE,*5**,1
- MOVE P1,D1 ADD 5,D1
- IFS NE,*P2**,1 IFS EQ,***
- ADD P2,D1 BRA.S ..0000
- IFS EQ,*P3** OR $FFFE,D1
- BRA.S JTAG ..0000 DS 0
- ELSE
- ADD P3,D1 CADD 4,,6 MOVE 4,D1
- ENDC IFS NE,***,1
- OR #$FFFE,D1 IFS EQ,*6**
- JTAG DS 0 ELSE
- ENDM ADD 6,D1
- OR #$FFFFE,D0
- ..0001 DS 0
-
-
-
-
-
- MACROL MACROL MACROL
-
-
-
- PURPOSE To define a macro.
-
-
-
- FORMAT macroname MACROL parameter1,parameter2,...parameterN
-
-
-
- DESCRIPTION MACROL is similiar to macro except that on the
- MACROL call the location field is treated as call
- parameter 1 instead of as a location field symbol.
- (See example for STRLEN)
-
-
-
-
- -47- MAC.68K
- MAC.68K
-
-
- MAX MAX MAX
-
-
-
- PURPOSE To generate a redefinable symbol equal to the
- largest value from the expression list in the operand
- field.
-
-
-
- FORMAT symbol MAX expression1,expression2,...expressionN
-
-
-
- DESCRIPTION MAX evaluates the expressions in the operand list
- and assigns the largest value found to the redefinable
- symbol in the location field. All symbols used in the
- expressions must be previously defined. If any errors
- are encountered the symbol is not (re)defined.
-
-
-
-
-
-
- MIN MIN MIN
-
-
- PURPOSE To generate a redefinable symbol equal to the
- smallest value from the expression list in the operand
- field.
-
-
-
- FORMAT symbol MIN expression1,expression2,...expressionN
-
-
-
- DESCRIPTION MIN evaluates the expressions in the operand list
- and assigns the smallest value found to the
- redefinable symbol in the location field. All symbols
- used in the expressions must be previously defined. If
- any errors are encountered the symbol is not
- (re)defined.
-
-
-
- EXAMPLES FOO MAX PAGESIZE,80
- BAZ MIN LENGTH1,LENGTH2,LENGTH3
-
-
-
-
-
-
-
-
-
- MAC.68K -48-
- MAC.68K
-
-
- MODULE MODULE MODULE
-
-
-
- PURPOSE To indicate a MAC.68K module assembly. The object
- file is generated with a .MOD file extension.
-
-
-
- FORMAT MODULE
-
-
-
- DESCRIPTION MODULE is an initialization directive. It must
- appear after the IDENT card but before any
- noninitialization operation codes. MODULE generates
- the .MOD files used with INCLUDEH.
-
- A module may contain CPU instructions and/or data.
- It differs from an included text file in that the
- module is assembled prior to its use and is converted
- from text into actual machine code. The default origin
- address for a module is $0 and there is no associated
- load address. Because it may be called anywhere within
- another program, a module should use relative
- addressing and avoid absolute addressing. A module may
- not use DATA or BSS segments.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -49- MAC.68K
- MAC.68K
-
-
- NOREF NOREF NOREF
-
-
- PURPOSE To disable cross references for specified symbols.
-
-
- FORMAT NOREF symbol1,symbol2,...symbolN
-
-
- DESCRIPTION NOREF turns off cross referencing for the specified
- symbols. Symbols in the NOREF list must be already
- defined.
-
-
- EXAMPLE NOREF TAG,TAG1
-
-
-
-
-
-
-
- OFFSET OFFSET OFFSET
-
-
- PURPOSE To change the assembly to an offset segment.
-
-
- FORMAT OFFSET expression
-
-
- DESCRIPTION OFFSET switches the assembly to a null segment. It
- is useful for defining symbols with values relative
- (offset) to the start of a table or buffer. Any type
- of instruction, data, or reservation op code may be
- used. Only the symbols in an offset segment are
- retained, any code, data, or reservation locations do
- not appear in the object file.
-
- The default starting offset address is zero. If
- expression is used, the value of the expression
- becomes the starting address for this offset segment.
- An offset segment, like any other segment, is
- terminated when the assembly is switched to another
- segment with a BSS, DATA, TEXT, SECTION, or END card.
-
-
-
-
-
-
-
-
-
-
-
-
-
- MAC.68K -50-
- MAC.68K
-
-
- OPSYN OPSYN OPSYN
-
-
-
- PURPOSE To equate a new operation code to an existing operation
- code, pseudo operation code, or macro name.
-
-
-
- FORMAT newname OPSYN opname
-
-
-
- DESCRIPTION OPSYN equates a new operation code, newname , to an
- existing operation name. This new name is independent
- of the existing name and is not affected by any later
- redefinition or PURGE of the existing name.
-
-
-
- EXAMPLE REPT OPSYN DUP
- EJECT OPSYN PAGE
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -51- MAC.68K
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -51-